home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
034a
/
twview82.zip
/
PORTSTAT.INC
< prev
next >
Wrap
Text File
|
1991-02-04
|
2KB
|
79 lines
function FindPortSlot( var top : PortIndex; which : sector ) : PortIndex;
{If which is already in the data base, return that location. If not, then if
we are full, return 0; otherwise add one to top and return it. }
var
i : portIndex;
found : boolean;
begin
found := false;
if top > 0 then
for i := 1 to top do
if space.ports.data[ i ].where = which then
begin
FindPortSlot := i;
found := true;
end;
if not found then
if top = MaxPorts then
FindPortSlot := 0
else
begin
top := top + 1;
FindPortSlot := top;
end; {else}
end; {FindPortSlot}
procedure GetPortStatus( s : sector;
var PortType : stuff;
line : string;
var ThePorts : Portlist );
var
ch : char;
pa : GoodsArray;
NewSlot : PortIndex;
begin
if pos( 'You can buy', line ) > 0 then
PortType := Class0
else
begin
readln( f, line ); { blank }
readln( f, line ); { items }
readln( f, line ); { ----- }
skip( f, 11 );
read( f, ch );
skip( f, 8 );
readln( f, pa[ Fuel ] );
if ch = 'B' then
begin
PortType := 0;
pa[ Fuel ] := -pa[ fuel ];
end {if}
else
PortType := 1;
skip( f, 11 );
read( f, ch );
skip( f, 8 );
readln( f, pa[ Organics ] );
if ch = 'B' then
pa[ Organics ] := -pa[ Organics ]
else
PortType := PortType + 2;
skip( f, 11 );
read( f, ch );
skip( f, 8 );
readln( f, pa[ Equipment ] );
if ch = 'B' then
pa[ Equipment ] := -pa[ Equipment ]
else
PortType := PortType + 4;
NewSlot := FindPortSlot( ThePorts.top, s );
if NewSlot = 0 then
writeln('Can''t record all of our port info!')
else
begin
ThePorts.data[ NewSlot ].where := s;
ThePorts.data[ NewSlot ].amts := pa;
end; {else}
end; {else}
end; {GetPortStatus}